<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMenusTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('menus', function (Blueprint $table) {
            $table->bigIncrements('id')->comment('主键ID');
            $table->string('name', 50)->default('')->comment('菜单路由名称');
            $table->string('title', 100)->default('')->comment('菜单标题');
            $table->string('icon')->default('')->comment('菜单图标');
            $table->unsignedBigInteger('parent_id')->default(0)->comment('上级菜单ID');
            $table->string('path')->default('')->comment('路由路径');
            $table->string('component_path')->default('')->comment('组件路径');
            $table->unsignedTinyInteger('is_enable')->default(0)->comment('是否启用');
            $table->unsignedInteger('created_time')->default(0)->comment('创建时间');
            $table->unsignedInteger('updated_time')->default(0)->comment('更新时间');

            /*索引配置--begin*/
            $table->index('name', 'name_index');
            /*索引配置--end*/

            /*基础配置--begin*/
            $table->comment = '后台-菜单表';
            $table->engine = 'InnoDB';
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_unicode_ci';
            /*基础配置--begin*/
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('menus');
    }
}
